home *** CD-ROM | disk | FTP | other *** search
- Path: pegasus.odyssee.net!news
- From: Kevin Swail <kyndar@odyssee.net>
- Newsgroups: comp.lang.c
- Subject: Getting the Address of the CD-ROM device driver through MSCDEX
- Date: Mon, 26 Feb 1996 19:23:30 -0800
- Organization: Odyssee Internet
- Message-ID: <31327932.7FA9@odyssee.net>
- NNTP-Posting-Host: pool9_2.odyssee.net
- Mime-Version: 1.0
- Content-Type: multipart/mixed; boundary="------------44953E4660FB"
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- This is a multi-part message in MIME format.
-
- --------------44953E4660FB
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
-
- To Anybody who can help!
-
- I've written the following C (TC v3.0) program in order to try to
- find the address of the CD-ROM device driver. It does not work however!
- For some reason, even though I pass the address of my strucure to the
- interrupt, it doesn't send me back the Driver address. Please Help! If
- I can get this working, then I have a chance at making a CD-ROM audio
- player using C. Thanks for the help!
-
- Kevin Swail
- kyndar@odyssee.net
-
- --------------44953E4660FB
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- Content-Disposition: inline; filename="!!!.C"
-
- // addr.c
- // gets the address of the device driver for the 1st CD-ROM, and its name
- // (note: For now only for 1 CD-ROM!)
- #include <dos.h> // for geninterrupt(), REGS etc...
- #include <stdio.h> // for printf() etc...
-
- struct DRIVER
- {
- unsigned char subunit; //subunit CD-ROM number
- unsigned int segment; //segment of CD-ROM device driver
- unsigned int offset; //offset of CD-ROM device driver
- };
-
- void main(void)
- {
- struct DRIVER driver;
- char far *farptr;
- int rep;
-
- printf("\n*Address of Device driver before interrupt call : %04X:%04X",
- driver.segment,driver.offset);
- _AX = 0x1501; //function to be used of int 2Fh
- _BX = FP_OFF((void far *) &driver); //BX must have offset of driver structure
- _ES = FP_SEG((void far *) &driver); //ES must have segment of driver structure
- geninterrupt(0x2F); //call int 2Fh (MSCDEX)
-
- printf("\n ES:BX --> %04X:%04X",_ES,_BX);
- printf("\nDriver sub-unit (CD-ROM number): %X",driver.subunit);
- printf("\n*Address of Device driver after interrupt call : %04X:%04X",
- driver.segment,driver.offset);
-
- //display name of driver
-
- farptr = MK_FP(driver.segment,driver.offset + 10);
-
- printf("\n\nValue of farptr : %lx\n",farptr);
- for (rep=0;rep<8;rep++)
- {
- printf("%c,",*(farptr+rep));
- }
- } //end of program
-
- --------------44953E4660FB--
-
-